package com.axonactive;

import java.util.ArrayList;
import java.util.List;

import javax.enterprise.context.RequestScoped;
import javax.faces.event.ActionEvent;
import javax.inject.Inject;
import javax.inject.Named;

@Named
@RequestScoped
public class BookManageBean {
	
	@Inject
	BookService bService;
	
	String name;
	float price;
	
	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public void saveBook(ActionEvent event)
	{
		Book b= new Book();
		b.name=this.name;
		b.price=this.price;
		bService.saveBook(b);
	}
	
	public List<Book> getBooks()
	{
		return bService.getBooks();
	}
	
}
